package de.hhbk.feedbackmodul.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;


public class TransactionInViewFilter implements Filter{
	
	/*
	@Resource
	private UserTransaction trans;
	
	/private SessionFactory sf;
	*/
	@Override
	public void destroy() {
		
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain filterchain) throws IOException, ServletException {
		/*try
		{
			if(trans.getStatus() != Status.STATUS_NO_TRANSACTION)
			{
				trans.rollback();
			}
			trans.begin();
			sf.openSession();*/
			
			filterchain.doFilter(request, response);

			/*sf.getCurrentSession().close();
			trans.commit();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}*/
		
	}

	@Override
	public void init(FilterConfig fc) throws ServletException {
	//	sf = HibernateUtil.getConfiguredSessionFactory();
	}

}
